<include file="Index:header" />
<!-- Content Header (Page header) -->
    <section class="content-header">
      <h1> 配置成员 </h1>
      <ol class="breadcrumb">
        <li><a href="__APP__/TIFAWEB_DSWJCMS.html" class="goindex"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li>用户管理</li>
        <li><a href="__APP__/TIFAWEB_DSWJCMS/User/userGroups.html" class="goindex">管理组管理</a></li>
        <li class="active">配置成员</li>
      </ol>
    </section>
<!--主体-->
    <!-- Main content -->
  <section class="content">
    <div class="box">
    <div class="box-header">
              
              <div class="box-tools">
                <a href="#" data-toggle="modal" data-target="#aDdit" onclick="getUser({$id})">添加成员</a>
              </div>
            </div>
    <div class="box-body">
    <div class="callout callout-info">
        <p>当管理员都已分配了对应的管理组时，无法通过“添加成员”进行添加</p>
    </div>
    <table class="table table-bordered"  id="example1">
           <thead>
              <tr>
                <th>用户名</th>
                <th>用户ID</th>
                <th>email</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
			 <volist name="list" id="vo">
              <tr>
                <td>{$vo.username}</td>
                <td>{$vo.id}</td>
                <td>
                   {$vo.email} 
                </td>
                <td><a href="#" class="fa fa-trash text-red" title="删除" 
                    onclick="if(confirm('是否要删除？'))window.location.href='__APP__/TIFAWEB_DSWJCMS/User/delGroupUser/uid/{$vo.id}'"></a>
                </td>
                </td>
              </tr>
            </volist>
            </tbody>
          </table>
     </div>
    </div>
  </section>
<include file="Index:footer" />
<!--添加成员 开始-->
<div class="modal fade" id="aDdit">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">添加成员</h4>
      </div>
    <form method="post"  action='__APP__/TIFAWEB_DSWJCMS/User/saveUser'>
    <input name="group_id" id="group_id" type="hidden" value="{$id}" />
      <div class="modal-body">
		<div id="addUsers" class="row"></div>
        	<div class="modal-footer">
            <button type="button" class="btn btn-default pull-left" data-dismiss="modal">取消</button>
            <button type="submit" class="btn btn-primary" >确定</button>
            
          </div>
      </div>
      </form>
    </div>
    <!-- /.modal-content -->
  </div>
  <!-- /.modal-dialog -->
</div>
<!--添加成员 结束-->
<script>
function getUser(id){
		var div='';
	    var mdata={'id':id};
		var url = "__APP__/TIFAWEB_DSWJCMS/User/viewUserAjax";
		  $.ajax({			
			  type:"POST",
			  data:mdata,
			  async:false,
			  url:url,
			  success: function(msg){
				  
				$.each(msg.info,function(k,v){
					
					div+="<div class='col-md-3'><input type='checkbox' name='guser[]' value ='"+k+"'>&nbsp;&nbsp;"+v+"</div>";
				})
				$('#addUsers').html(div);
			  }
		 });
}
   
$(function () {
    $('#example1').DataTable({
		language: {  
		  "sProcessing": "处理中...",  
		  "sLengthMenu": "显示 _MENU_ 项结果",  
		  "sZeroRecords": "没有匹配结果",  
		  "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",  
		  "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",  
		  "sInfoFiltered": "(由 _MAX_ 项结果过滤)",  
		  "sInfoPostFix": "",  
		  "sSearch": "搜索:",  
		  "sUrl": "",  
		  "sEmptyTable": "表中数据为空",  
		  "sLoadingRecords": "载入中...",  
		  "sInfoThousands": ",",  
		  "oPaginate": {  
			  "sFirst": "首页",  
			  "sPrevious": "上页",  
			  "sNext": "下页",  
			  "sLast": "末页"  
		  },  
		  "oAria": {  
			  "sSortAscending": ": 以升序排列此列",  
			  "sSortDescending": ": 以降序排列此列"  
		  }  
	  }  
	})
})
</script>